﻿/// <reference path="../lib/amplify.js" />

/**
 @title:        dataservice.workspace
 @description:  Responsible for communications with services to receive data from server. Expose communication interfaces.
 @author:       Yuriy Shapovalov               
 */

define('dataservice.workspace',
    ['amplify'],
    function () {
        var
            /**
             @description: Initialize requests to server using amplify.js library
             */
            init = function () {
                amplify.request.define('workspace', 'ajax', {
                    url: '/api/workspace',
                    dataType: 'json',
                    type: 'GET'
                });
            },

            getWorkspace = function (callbacks) {
                return amplify.request({
                    resourceId: 'workspace',
                    data: '',
                    success: callbacks.success,
                    error: callbacks.error
                });
            };

        init();

        return {
            getWorkspace: getWorkspace
        };
    });